package cn.daomeng.firebird.mq.rabbit;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

/**
 * 消息监听工具
 * @author qsl
 * @date 2019.05.13
 */
public abstract class AbstractRabbitMessageListener implements RabbitMessageListener {

    private String targetQueueName;

    private int concurrent = DEFAULT_RECEIVE_NUM;

    private int acknowledgeMode = ACK_MODE_AUTO;

    public AbstractRabbitMessageListener(String queueName) {
        this(queueName, ACK_MODE_AUTO,DEFAULT_RECEIVE_NUM);
    }

    public AbstractRabbitMessageListener(String queueName, int ackMode) {
        this(queueName, ackMode,DEFAULT_RECEIVE_NUM);
    }

    public AbstractRabbitMessageListener(String queueName, int ackMode, int concurrent ) {
        this.targetQueueName = queueName;
        this.acknowledgeMode = ackMode;
        this.concurrent = concurrent;
    }

    @Override
    public int getAcknowledgeMode() {
        return acknowledgeMode;
    }


    @Override
    public String getTargetQueueName() {
        return targetQueueName;
    }

    @Override
    public void handleMessage(Object object) {
    }

    @Override
    public void handleMessage(Object object , Message message , Channel channel) {
    }

    @Override
    public int getConcurrent() {
        return concurrent;
    }
}
